package top.songxs.yygh.hosp.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.songxs.yygh.common.result.R;
import top.songxs.yygh.hosp.service.ScheduleService;
import top.songxs.yygh.model.hosp.Schedule;
import top.songxs.yygh.vo.hosp.ScheduleOrderVo;

import java.util.List;
import java.util.Map;


@RestController
@RequestMapping("admin/hosp/schedule")
public class ScheduleController {
    @Autowired
    ScheduleService scheduleService;

    //获取排版规则并分页
    @GetMapping("/getScheduleRule/{pageNum}/{pageSize}/{hoscode}/{depcode}")
    public R getScheduleRoule(@PathVariable Integer pageNum ,
                              @PathVariable Integer pageSize,
                              @PathVariable String hoscode,
                              @PathVariable String depcode){
        Map<String , Object> map = scheduleService.getScheduleRoules(pageNum, pageSize, hoscode, depcode);

        return R.ok().data(map);
    }

    //根据医院编号 、科室编号和工作日期，查询排班详细信息
    @ApiOperation(value = "查询排班详细信息")
    @GetMapping("getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public R getScheduleDetail(@PathVariable String hoscode,
                               @PathVariable String depcode,
                               @PathVariable String workDate) {
        List<Schedule> list = scheduleService.getDetailSchedule(hoscode,depcode,workDate);
        return R.ok().data("list",list);
    }



}
